/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.kj.entity;

import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.utils.excel.annotation.ExcelField;
import com.jeesite.common.utils.excel.annotation.ExcelFields;
import org.hibernate.validator.constraints.Length;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.Date;
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
/**
 * kj_member_integral_historyEntity
 * @author hzy
 * @version 2021-07-04
 */
@Table(name="kj_member_integral_history", alias="a", columns={
		@Column(name="id", attrName="id", label="id", isPK=true),
		@Column(name="member_id", attrName="kjMember.id", label="用户id"),
		@Column(name="member_name", attrName="kjMember.name", label="用户名", queryType = QueryType.LIKE),
		@Column(name="integral_type", attrName="integralType", label="积分类型"),
		@Column(name="integral", attrName="integral", label="变动积分"),
		@Column(name="hours", attrName="hours", label="变动时长"),
		@Column(name="relation_id", attrName="relationId", label="关联ID"),
		@Column(name="integral_type_name", attrName="integralTypeName", label="积分类型名"),
		@Column(name="job_type_id", attrName="jobTypeId", label="岗位类型ID"),
		@Column(includeEntity=DataEntity.class),
	}, joinTable={
		@JoinTable(type= JoinTable.Type.LEFT_JOIN, entity= KjMember.class, alias="m",
				on="m.id = a.member_id",
				columns={@Column(includeEntity=KjMember.class)})
}
	, orderBy="a.update_date DESC"
)
public class KjMemberIntegralHistory extends DataEntity<KjMemberIntegralHistory> {

	private static final long serialVersionUID = 1L;
	private KjMember kjMember;		// 用户id
	private String integralType;		// 积分类型
	private String integralTypeName;		// 积分类型
	private BigDecimal integral;		// 变动积分
	private BigDecimal hours;		// 变动时长
	private String relationId;

	private String myCity;//搜索是否本市
	private String jobTypeId;


	public KjMemberIntegralHistory() {
		this(null);
	}

	public KjMemberIntegralHistory(String id){
		super(id);
	}


	@Valid
	@ExcelFields({
			@ExcelField(title="用户名", attrName="kjMember.name", align=Align.CENTER, sort=35),
			@ExcelField(title="积分类型", attrName="integralType", dictType = "integral_type", align= Align.CENTER, sort=50),
			@ExcelField(title="捐赠积分", attrName="integral", align=Align.CENTER, sort=55),
			})
	public KjMember getKjMember() {
		return kjMember;
	}

	public void setKjMember(KjMember kjMember) {
		this.kjMember = kjMember;
	}

	@Length(min=0, max=255, message="积分类型长度不能超过 255 个字符")
	public String getIntegralType() {
		return integralType;
	}

	public void setIntegralType(String integralType) {
		this.integralType = integralType;
	}

	public BigDecimal getIntegral() {
		return integral;
	}

	public void setIntegral(BigDecimal integral) {
		this.integral = integral;
	}

	public String getRelationId() {
		return relationId;
	}

	public void setRelationId(String relationId) {
		this.relationId = relationId;
	}

	public String getIntegralTypeName() {
		return integralTypeName;
	}

	public void setIntegralTypeName(String integralTypeName) {
		this.integralTypeName = integralTypeName;
	}


	// 不等于 !=
	public String[] getIntegralType_In() {
		return sqlMap.getWhere().getValue("integral_type", QueryType.IN);
	}

	public void setIntegralType_In(String...integralType) {
		sqlMap.getWhere().and("integral_type", QueryType.IN, integralType);
	}

	public void setIntegral_lte(BigDecimal integral){
		getSqlMap().getWhere().and("integral", QueryType.LTE, integral);
	}
	public void setRelationId_like(String relationId){
		getSqlMap().getWhere().and("relation_id", QueryType.LIKE, relationId);
	}
	public String getRelationId_like(){
		return getSqlMap().getWhere().getValue("relation_id", QueryType.LIKE);
	}
	public BigDecimal getIntegral_lte(){
		return getSqlMap().getWhere().getValue("integral", QueryType.LTE);
	}

	public void setIntegral_gte(BigDecimal integral){
		getSqlMap().getWhere().and("integral", QueryType.GTE, integral);
	}

	public BigDecimal getIntegral_gte(){
		return getSqlMap().getWhere().getValue("integral", QueryType.GTE);
	}

	public BigDecimal getHours() {
		return hours;
	}

	public void setHours(BigDecimal hours) {
		this.hours = hours;
	}

	public String getMyCity() {
		return myCity;
	}

	public void setMyCity(String myCity) {
		this.myCity = myCity;
	}

	public String getJobTypeId() {
		return jobTypeId;
	}

	public void setJobTypeId(String jobTypeId) {
		this.jobTypeId = jobTypeId;
	}
}
